﻿<UserControl x:Class="Bio.Views.Alignment.Views.BirdsEyeViewer"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:julmar="clr-namespace:JulMar.Windows.Converters;assembly=JulMar.Wpf.Helpers" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" Background="#FF595959" UseLayoutRounding="True">

    <Grid x:Name="rootGrid">
        <Viewbox Stretch="Fill">
            <Canvas Margin="5" Width="{Binding ElementName=img, Path=ActualWidth}" Height="{Binding ElementName=img, Path=ActualHeight}">
                <Image x:Name="img" Source="{Binding BevImage}" Stretch="None" HorizontalAlignment="Left" VerticalAlignment="Top"
                         RenderOptions.BitmapScalingMode="NearestNeighbor" RenderOptions.EdgeMode="Aliased" />
                <Rectangle x:Name="rcBox" Stroke="Black" StrokeThickness="1"  HorizontalAlignment="Left" VerticalAlignment="Top" Fill="#90B9D3E2" 
                          Width="{Binding VisibleColumns}" Height="{Binding VisibleRows}" Cursor="Hand" Canvas.Left="{Binding FirstColumn}" Canvas.Top="{Binding TopRow}" />
            </Canvas>
        </Viewbox>

        <Popup x:Name="positionText" PlacementTarget="{Binding ElementName=rootGrid}" Placement="Center">
            <Border BorderBrush="Black" Background="White" BorderThickness="1">
                <Border.Effect>
                    <DropShadowEffect />
                </Border.Effect>
                <TextBlock Foreground="Black" Text="{Binding PositionText}" Margin="5" />
            </Border>
        </Popup>

        <Grid Visibility="{Binding IsRendering, Converter={julmar:BooleanToVisibilityConverter}}">
            <Rectangle Fill="#90000000" />
            <TextBlock HorizontalAlignment="Center" FontSize="12pt" Foreground="Black" VerticalAlignment="Center" Text="Generating View..." />
            <TextBlock Margin="2,2,0,0" HorizontalAlignment="Center" FontSize="12pt" Foreground="White" VerticalAlignment="Center" Text="Generating View..." />
        </Grid>
        
    </Grid>
</UserControl>
